<?php
if (!defined('WEB_ROOT')) {
	exit;
}

// make sure a product id exists
if (isset($_GET['id']) && $_GET['id'] > 0) {
	$id = (int)$_GET['id'];
} else {
	// redirect to index.php if product id is not present
	header('Location: index.php');
}

$sql = "	SELECT tg.id, matg, hotentg, ngaysinh, quequantg, chucvu, diachi, dienthoai, email, didong, hocham, hocvi, tendv, tennnc, ngaythamgia, hinhanh

			FROM tacgia tg left join donvi dv on  tg.dv_id = dv.id  left join tacgia_nhomnc tgn on tg.id = tgn.tg_id left join nhomnc nnc on tgn.nhomnc_id = nnc.id
			WHERE tg.id = $id";
$result = mysql_query($sql) or die('Không lấy được thông tin tác giả. ' . mysql_error());

$row = mysql_fetch_assoc($result);
extract($row);

if ($hinhanh) {
	$hinhanh = WEB_ROOT . 'images/author/' . $hinhanh;
} else {
	$hinhanh = WEB_ROOT . 'images/no-image-small.png';
}

?>
<br />
<form action="processAuthor.php?action=addAuthor" method="post" enctype="multipart/form-data" name="frmAddAuthor" id="frmAddAuthor">
 <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
  <tr><td colspan="4" id="entryTableHeader">Thông tin chi tiết tác giả</td></tr>
  <tr> 
   <td width="170" class="label">Mã tác giả</td>
   <td class="content" colspan="3"><?php echo $matg; ?></td>
  </tr>
  <tr> 
   <td width="170" class="label">Họ tên tác giả</td>
   <td class="content" colspan="3"> <b><?php echo $hotentg; ?></b></td>
  </tr>
  <tr> 
   <td width="170" class="label">Ngày sinh</td>
   <td class="content" colspan="3"><?php echo $ngaysinh; ?> </td>
  </tr>
  <tr> 
   <td width="170" class="label">Quê quán</td>
   <td class="content" colspan="3"><?php echo $quequantg; ?> </td>
  </tr>
    <tr> 
   <td width="170" class="label">Đơn vị</td>
   <td class="content" colspan="3"><?php echo $tendv; ?> </td>
  </tr>
  <tr> 
   <td width="170" class="label">Chức vụ</td>
   <td class="content" colspan="3"><?php echo $chucvu; ?> </td>
  </tr>
  <tr> 
   <td width="170" class="label">Địa chỉ liên lạc</td>
   <td class="content" colspan="3"><?php echo $diachi; ?> </td>
  </tr>
  <tr> 
   <td width="170" class="label">Điện thoại nhà riêng</td>
   <td class="content" colspan="3"><?php echo $dienthoai; ?> </td>
  </tr>
   <tr> 
	   <td width="170" class="label">Điện thoại di động</td>
	   <td width="464" class="content"><?php echo $didong; ?></td>
       <td width="236" class="label">Email</td>
       <td width="422" class="content"><?php echo $email; ?></td>
  </tr>
  <tr> 
	   <td class="label">Học hàm</td>
	   <td class="content"><?php echo $hocham; ?></td>
       <td class="label">Học vị</span></td>
       <td class="content"><?php echo $hocvi; ?></td>
  </tr>

  <tr> 
   <td width="170" class="label">Hình ảnh</td>
   <td class="content"  colspan="3" ><img src="<?php echo $hinhanh; ?>"></td>
  </tr>
  <tr> 
	   <td width="170" class="label">Nhóm nghiên cứu</td>
	   <td class="content"><?php echo $tennnc; ?></td>
       <td class="label">Ngày tham gia</td>
       <td class="content"><?php echo $ngaythamgia; ?></td>
  </tr>
 </table>
 <p align="center"> 
  <input name="btnModifyProduct" type="button" id="btnModifyAuthor" value="Sửa thông tin tác giả" onClick="window.location.href='index.php?view=modify&matg=<?php echo $matg; ?>&nhomnc_id=<?php echo $nhomnc_id; ?>';" class="box">
  &nbsp;&nbsp;
   <input name="btnListResearchWork" type="button" id="btnListResearchWork" value="Xem danh mục công trình NCKH của tác giả" onClick="window.location.href='index.php?view=listresearchwork&id=<?php echo $id; ?>';" class="box">
  &nbsp;&nbsp;
  <input name="btnBack" type="button" id="btnBack" value=" Trở lại " onClick="window.history.back();" class="box">
 </p>
</form>
